﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Inventory.aspx.cs" Inherits="LadyBugWeb.Page.Inventory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Inventory</h1>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="Prod_id" DataSourceID="tblProduct" 
        AllowPaging="True" AllowSorting="True" BackColor="White" BorderColor="#E7E7FF" 
        BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" 
        Height="219px" Width="889px">
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <Columns>
                        <asp:BoundField DataField="Prod_id" HeaderText="Prod_id" ReadOnly="True" 
                            SortExpression="Prod_id" InsertVisible="False"/>
                        <asp:BoundField DataField="Prod_Name" HeaderText="Prod_Name" 
                            SortExpression="Prod_Name"/>
                        <asp:BoundField DataField="ProdGrp_name" 
                            HeaderText="ProdGrp_name" SortExpression="ProdGrp_name"/>
                        <asp:BoundField DataField="Prod_Description" HeaderText="Prod_Description" 
                            SortExpression="Prod_Description" />
                        <asp:BoundField DataField="sup_name" HeaderText="sup_name" 
                            SortExpression="sup_name" />
                        <asp:BoundField DataField="Prod_UPC" HeaderText="Prod_UPC" 
                            SortExpression="Prod_UPC"/>
                        <asp:BoundField DataField="Prod_BrandName" HeaderText="Prod_BrandName" 
                            SortExpression="Prod_BrandName"/>
                        <asp:BoundField DataField="Prod_ManufCode" HeaderText="Prod_ManufCode" 
                            SortExpression="Prod_ManufCode"/>
                        <asp:BoundField DataField="Prod_Manufacturer" HeaderText="Prod_Manufacturer" 
                            SortExpression="Prod_Manufacturer" />
                        <asp:BoundField DataField="store_name" HeaderText="store_name" 
                            SortExpression="store_name"/>
                        <asp:BoundField DataField="Prod_SellingUnit" 
                            HeaderText="Prod_SellingUnit" SortExpression="Prod_SellingUnit"/>
                        <asp:BoundField DataField="Prod_MinQuantityOnHand" 
                            HeaderText="Prod_MinQuantityOnHand" 
                            SortExpression="Prod_MinQuantityOnHand"/>
                        <asp:BoundField DataField="Prod_MaxQuantityOnHand" HeaderText="Prod_MaxQuantityOnHand" 
                            SortExpression="Prod_MaxQuantityOnHand"/>
                        <asp:BoundField DataField="Prod_SellngPrice" 
                            HeaderText="Prod_SellngPrice" SortExpression="Prod_SellngPrice" />
                        <asp:BoundField DataField="Prod_quantityOnHand" 
                            HeaderText="Prod_quantityOnHand" SortExpression="Prod_quantityOnHand" />
                    </Columns>
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <SortedAscendingCellStyle BackColor="#F4F4FD" />
                    <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
                    <SortedDescendingCellStyle BackColor="#D8D8F0" />
                    <SortedDescendingHeaderStyle BackColor="#3E3277" />
                </asp:GridView>
                <asp:DetailsView ID="DetailsView1" runat="server" BackColor="White" 
        BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
        GridLines="Horizontal" Height="50px" Width="878px" 
        AutoGenerateRows="False" DataKeyNames="Prod_id" DataSourceID="tblProduct" 
        AllowPaging="True">
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <Fields>
                        <asp:BoundField DataField="Prod_id" HeaderText="Prod_id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="Prod_id" />
                        <asp:BoundField DataField="Prod_Name" HeaderText="Prod_Name" 
                            SortExpression="Prod_Name" />
                        <asp:TemplateField HeaderText="ProdGrp_name" SortExpression="ProdGrp_name">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProdGrp_name") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <InsertItemTemplate>
                                <asp:DropDownList ID="cboBox_ProductGroup" runat="server" 
                                    DataSourceID="prodgroup3" DataTextField="ProdGrp_name" 
                                    DataValueField="ProdGrp_name" Height="21px" 
                                    SelectedValue='<%# Bind("ProdGrp_name") %>' Width="261px">
                                </asp:DropDownList>
                            </InsertItemTemplate>
                            <ItemTemplate>
                                <asp:DropDownList ID="cboBox_ProductGroup" runat="server" 
                                    DataSourceID="prodgroup3" DataTextField="ProdGrp_name" 
                                    DataValueField="ProdGrp_name" Height="18px" 
                                    SelectedValue='<%# Bind("ProdGrp_name") %>' Width="250px">
                                    <asp:ListItem>Test group</asp:ListItem>
                                </asp:DropDownList>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Prod_Description" HeaderText="Prod_Description" 
                            SortExpression="Prod_Description" />
                        <asp:BoundField DataField="sup_name" HeaderText="sup_name" 
                            SortExpression="sup_name" />
                        <asp:BoundField DataField="Prod_UPC" HeaderText="Prod_UPC" 
                            SortExpression="Prod_UPC" />
                        <asp:BoundField DataField="Prod_BrandName" HeaderText="Prod_BrandName" 
                            SortExpression="Prod_BrandName" />
                        <asp:BoundField DataField="Prod_ManufCode" HeaderText="Prod_ManufCode" 
                            SortExpression="Prod_ManufCode" />
                        <asp:BoundField DataField="Prod_Manufacturer" HeaderText="Prod_Manufacturer" 
                            SortExpression="Prod_Manufacturer" />
                        <asp:BoundField DataField="store_name" HeaderText="store_name" 
                            SortExpression="store_name" />
                        <asp:BoundField DataField="Prod_SellingUnit" HeaderText="Prod_SellingUnit" 
                            SortExpression="Prod_SellingUnit" />
                        <asp:BoundField DataField="Prod_MinQuantityOnHand" 
                            HeaderText="Prod_MinQuantityOnHand" SortExpression="Prod_MinQuantityOnHand" />
                        <asp:BoundField DataField="Prod_MaxQuantityOnHand" 
                            HeaderText="Prod_MaxQuantityOnHand" SortExpression="Prod_MaxQuantityOnHand" />
                        <asp:BoundField DataField="Prod_SellngPrice" HeaderText="Prod_SellngPrice" 
                            SortExpression="Prod_SellngPrice" />
                        <asp:BoundField DataField="Prod_quantityOnHand" 
                            HeaderText="Prod_quantityOnHand" SortExpression="Prod_quantityOnHand" />
                        <asp:TemplateField ShowHeader="False">
                            <EditItemTemplate>
                                <asp:Button ID="btn_Update" CommandName="Update" runat="server" Height="31px" Text="Update"  CausesValidation="True" 
                                    Width="131px" />
                                <asp:Button ID="btn_cancel" runat="server" Height="31px" Text="Cancel"  CausesValidation="True" 
                                    Width="131px"  CommandName="Cancel"/>
                            </EditItemTemplate>
                            <InsertItemTemplate>
                                <asp:Button ID="Button1" runat="server" Height="31px" Text="Insert" 
                                    Width="131px"  CausesValidation="False" CommandName="Insert" />
                                <asp:Button ID="Button2" runat="server" Height="31px" Text="Cancel" 
                                    Width="131px"  CausesValidation="True"  CommandName="Cancel" />
                            </InsertItemTemplate>
                            <ItemTemplate>
                                <asp:Button ID="Button1" runat="server" Height="31px" Text="Edit"  CausesValidation="False" 
                                    CommandName="Edit" Width="131px" />
                                <asp:Button ID="Button2" runat="server" Height="31px" Text="New" CausesValidation="False" 
                                    CommandName="New" Width="131px" />
                                <asp:Button ID="Button3" runat="server" Height="31px" Text="Delete"  Width="131px"  CausesValidation="False" 
                                    CommandName="Delete" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
    </asp:DetailsView>
    <br />
                <asp:SqlDataSource ID="tblProduct" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:LadyBugDBConnectionString1 %>" 
                    
                    SelectCommand="SELECT tblProducts.Prod_id, tblProducts.Prod_Name, tblProductGroup.ProdGrp_name, tblProducts.Prod_Description, tblSupplier.sup_name, tblProducts.Prod_UPC, tblProducts.Prod_BrandName, tblProducts.Prod_ManufCode, tblProducts.Prod_Manufacturer, tblStore.store_name, tblProducts.Prod_SellingUnit, tblProducts.Prod_MinQuantityOnHand, tblProducts.Prod_MaxQuantityOnHand, tblProducts.Prod_SellngPrice, tblProducts.Prod_quantityOnHand FROM tblProducts INNER JOIN tblProductGroup ON tblProducts.ProdGrp_id = tblProductGroup.ProdGrp_id INNER JOIN tblStore ON tblProducts.Prod_StoreLocationID = tblStore.store_id INNER JOIN tblSupplier ON tblProducts.Prod_PrefSupplierID = tblSupplier.sup_id" 
                    ConflictDetection="CompareAllValues" 
                    DeleteCommand="DELETE FROM [tblProduct] WHERE [Prod_id] = @original_Prod_id AND [Prod_Name] = @original_Prod_Name AND [Prod_GroupId] = @original_Prod_GroupId AND (([Prod_Description] = @original_Prod_Description) OR ([Prod_Description] IS NULL AND @original_Prod_Description IS NULL)) AND (([Prod_PrefSupplierID] = @original_Prod_PrefSupplierID) OR ([Prod_PrefSupplierID] IS NULL AND @original_Prod_PrefSupplierID IS NULL)) AND (([Prod_UPC] = @original_Prod_UPC) OR ([Prod_UPC] IS NULL AND @original_Prod_UPC IS NULL)) AND (([Prod_BrandName] = @original_Prod_BrandName) OR ([Prod_BrandName] IS NULL AND @original_Prod_BrandName IS NULL)) AND (([Prod_ManufCode] = @original_Prod_ManufCode) OR ([Prod_ManufCode] IS NULL AND @original_Prod_ManufCode IS NULL)) AND (([Prod_Manufacturer] = @original_Prod_Manufacturer) OR ([Prod_Manufacturer] IS NULL AND @original_Prod_Manufacturer IS NULL)) AND (([Prod_StoreLocationID] = @original_Prod_StoreLocationID) OR ([Prod_StoreLocationID] IS NULL AND @original_Prod_StoreLocationID IS NULL)) AND (([Prod_SellingUnit] = @original_Prod_SellingUnit) OR ([Prod_SellingUnit] IS NULL AND @original_Prod_SellingUnit IS NULL)) AND (([Prod_MinQuantityOnHand] = @original_Prod_MinQuantityOnHand) OR ([Prod_MinQuantityOnHand] IS NULL AND @original_Prod_MinQuantityOnHand IS NULL)) AND (([Prod_MaxQuantityOnHand] = @original_Prod_MaxQuantityOnHand) OR ([Prod_MaxQuantityOnHand] IS NULL AND @original_Prod_MaxQuantityOnHand IS NULL)) AND (([Prod_SellngPrice] = @original_Prod_SellngPrice) OR ([Prod_SellngPrice] IS NULL AND @original_Prod_SellngPrice IS NULL)) AND (([Prod_QuantityOnHand] = @original_Prod_QuantityOnHand) OR ([Prod_QuantityOnHand] IS NULL AND @original_Prod_QuantityOnHand IS NULL))" 
                    InsertCommand="INSERT INTO [tblProduct] ([Prod_id], [Prod_Name], [Prod_GroupId], [Prod_Description], [Prod_PrefSupplierID], [Prod_UPC], [Prod_BrandName], [Prod_ManufCode], [Prod_Manufacturer], [Prod_StoreLocationID], [Prod_SellingUnit], [Prod_MinQuantityOnHand], [Prod_MaxQuantityOnHand], [Prod_SellngPrice], [Prod_QuantityOnHand]) VALUES (@Prod_id, @Prod_Name, @Prod_GroupId, @Prod_Description, @Prod_PrefSupplierID, @Prod_UPC, @Prod_BrandName, @Prod_ManufCode, @Prod_Manufacturer, @Prod_StoreLocationID, @Prod_SellingUnit, @Prod_MinQuantityOnHand, @Prod_MaxQuantityOnHand, @Prod_SellngPrice, @Prod_QuantityOnHand)" 
                    OldValuesParameterFormatString="original_{0}" 
                    
                    
        UpdateCommand="UPDATE [tblProduct] SET [Prod_Name] = @Prod_Name, [Prod_GroupId] = @Prod_GroupId, [Prod_Description] = @Prod_Description, [Prod_PrefSupplierID] = @Prod_PrefSupplierID, [Prod_UPC] = @Prod_UPC, [Prod_BrandName] = @Prod_BrandName, [Prod_ManufCode] = @Prod_ManufCode, [Prod_Manufacturer] = @Prod_Manufacturer, [Prod_StoreLocationID] = @Prod_StoreLocationID, [Prod_SellingUnit] = @Prod_SellingUnit, [Prod_MinQuantityOnHand] = @Prod_MinQuantityOnHand, [Prod_MaxQuantityOnHand] = @Prod_MaxQuantityOnHand, [Prod_SellngPrice] = @Prod_SellngPrice, [Prod_QuantityOnHand] = @Prod_QuantityOnHand WHERE [Prod_id] = @original_Prod_id AND [Prod_Name] = @original_Prod_Name AND [Prod_GroupId] = @original_Prod_GroupId AND (([Prod_Description] = @original_Prod_Description) OR ([Prod_Description] IS NULL AND @original_Prod_Description IS NULL)) AND (([Prod_PrefSupplierID] = @original_Prod_PrefSupplierID) OR ([Prod_PrefSupplierID] IS NULL AND @original_Prod_PrefSupplierID IS NULL)) AND (([Prod_UPC] = @original_Prod_UPC) OR ([Prod_UPC] IS NULL AND @original_Prod_UPC IS NULL)) AND (([Prod_BrandName] = @original_Prod_BrandName) OR ([Prod_BrandName] IS NULL AND @original_Prod_BrandName IS NULL)) AND (([Prod_ManufCode] = @original_Prod_ManufCode) OR ([Prod_ManufCode] IS NULL AND @original_Prod_ManufCode IS NULL)) AND (([Prod_Manufacturer] = @original_Prod_Manufacturer) OR ([Prod_Manufacturer] IS NULL AND @original_Prod_Manufacturer IS NULL)) AND (([Prod_StoreLocationID] = @original_Prod_StoreLocationID) OR ([Prod_StoreLocationID] IS NULL AND @original_Prod_StoreLocationID IS NULL)) AND (([Prod_SellingUnit] = @original_Prod_SellingUnit) OR ([Prod_SellingUnit] IS NULL AND @original_Prod_SellingUnit IS NULL)) AND (([Prod_MinQuantityOnHand] = @original_Prod_MinQuantityOnHand) OR ([Prod_MinQuantityOnHand] IS NULL AND @original_Prod_MinQuantityOnHand IS NULL)) AND (([Prod_MaxQuantityOnHand] = @original_Prod_MaxQuantityOnHand) OR ([Prod_MaxQuantityOnHand] IS NULL AND @original_Prod_MaxQuantityOnHand IS NULL)) AND (([Prod_SellngPrice] = @original_Prod_SellngPrice) OR ([Prod_SellngPrice] IS NULL AND @original_Prod_SellngPrice IS NULL)) AND (([Prod_QuantityOnHand] = @original_Prod_QuantityOnHand) OR ([Prod_QuantityOnHand] IS NULL AND @original_Prod_QuantityOnHand IS NULL))">
                    <DeleteParameters>
                        <asp:Parameter Name="original_Prod_id" Type="Int32" />
                        <asp:Parameter Name="original_Prod_Name" Type="String" />
                        <asp:Parameter Name="original_Prod_GroupId" Type="Int32" />
                        <asp:Parameter Name="original_Prod_Description" Type="String" />
                        <asp:Parameter Name="original_Prod_PrefSupplierID" Type="Int32" />
                        <asp:Parameter Name="original_Prod_UPC" Type="String" />
                        <asp:Parameter Name="original_Prod_BrandName" Type="String" />
                        <asp:Parameter Name="original_Prod_ManufCode" Type="String" />
                        <asp:Parameter Name="original_Prod_Manufacturer" Type="String" />
                        <asp:Parameter Name="original_Prod_StoreLocationID" Type="Int32" />
                        <asp:Parameter Name="original_Prod_SellingUnit" Type="String" />
                        <asp:Parameter Name="original_Prod_MinQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="original_Prod_MaxQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="original_Prod_SellngPrice" Type="Decimal" />
                        <asp:Parameter Name="original_Prod_QuantityOnHand" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Prod_id" Type="Int32" />
                        <asp:Parameter Name="Prod_Name" Type="String" />
                        <asp:Parameter Name="Prod_GroupId" Type="Int32" />
                        <asp:Parameter Name="Prod_Description" Type="String" />
                        <asp:Parameter Name="Prod_PrefSupplierID" Type="Int32" />
                        <asp:Parameter Name="Prod_UPC" Type="String" />
                        <asp:Parameter Name="Prod_BrandName" Type="String" />
                        <asp:Parameter Name="Prod_ManufCode" Type="String" />
                        <asp:Parameter Name="Prod_Manufacturer" Type="String" />
                        <asp:Parameter Name="Prod_StoreLocationID" Type="Int32" />
                        <asp:Parameter Name="Prod_SellingUnit" Type="String" />
                        <asp:Parameter Name="Prod_MinQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="Prod_MaxQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="Prod_SellngPrice" Type="Decimal" />
                        <asp:Parameter Name="Prod_QuantityOnHand" Type="Int32" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Prod_Name" Type="String" />
                        <asp:Parameter Name="Prod_GroupId" Type="Int32" />
                        <asp:Parameter Name="Prod_Description" Type="String" />
                        <asp:Parameter Name="Prod_PrefSupplierID" Type="Int32" />
                        <asp:Parameter Name="Prod_UPC" Type="String" />
                        <asp:Parameter Name="Prod_BrandName" Type="String" />
                        <asp:Parameter Name="Prod_ManufCode" Type="String" />
                        <asp:Parameter Name="Prod_Manufacturer" Type="String" />
                        <asp:Parameter Name="Prod_StoreLocationID" Type="Int32" />
                        <asp:Parameter Name="Prod_SellingUnit" Type="String" />
                        <asp:Parameter Name="Prod_MinQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="Prod_MaxQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="Prod_SellngPrice" Type="Decimal" />
                        <asp:Parameter Name="Prod_QuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="original_Prod_id" Type="Int32" />
                        <asp:Parameter Name="original_Prod_Name" Type="String" />
                        <asp:Parameter Name="original_Prod_GroupId" Type="Int32" />
                        <asp:Parameter Name="original_Prod_Description" Type="String" />
                        <asp:Parameter Name="original_Prod_PrefSupplierID" Type="Int32" />
                        <asp:Parameter Name="original_Prod_UPC" Type="String" />
                        <asp:Parameter Name="original_Prod_BrandName" Type="String" />
                        <asp:Parameter Name="original_Prod_ManufCode" Type="String" />
                        <asp:Parameter Name="original_Prod_Manufacturer" Type="String" />
                        <asp:Parameter Name="original_Prod_StoreLocationID" Type="Int32" />
                        <asp:Parameter Name="original_Prod_SellingUnit" Type="String" />
                        <asp:Parameter Name="original_Prod_MinQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="original_Prod_MaxQuantityOnHand" Type="Int32" />
                        <asp:Parameter Name="original_Prod_SellngPrice" Type="Decimal" />
                        <asp:Parameter Name="original_Prod_QuantityOnHand" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="prodgroup3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LadyBugDBConnectionString1 %>" 
        SelectCommand="SELECT [ProdGrp_name] FROM [tblProductGroup]">
    </asp:SqlDataSource>
    <br />
        </asp:Content>
